'Hazardous Agent Requirement Script  
Option Strict Off
imports System
imports PHSRAG.Insight21.Humans
imports PHSRAG.Insight21.BusinessObjects
imports FormsManagement = PHSRAG.Insight21.FormsManagement
imports CDS = PHSRAG.Insight21.CDS

module Script
sub Main()

    Dim hazardTypeAnswers as System.Collections.ArrayList = questAnswer.GetAnswers("HazardType")

    if hazardTypeAnswers.Count > 0 then
        Dim hazardTypeAnswer as FormsManagement.Answer = hazardTypeAnswers(0)
        Dim refCodes as CDS.RefCodes = new CDS.RefCodes(cachePolicy)
        refCodes.Load(connectionString, Nothing)

        select case hazardTypeAnswer.Value
            case "Bio"
                Dim biologicalAnswers as System.Collections.ArrayList = questAnswer.GetAnswers("Bio")
                if biologicalAnswers.Count > 0 then
                      questAnswer.Name = refCodes.GetRefCode("ANMBIOLOGICAL", biologicalAnswers(0).Value).Meaning
                end if
                theProtocol.BiologicalAgent = true
            case "Chem"
                Dim chemicalAnswers as System.Collections.ArrayList = questAnswer.GetAnswers("Chem")
                if chemicalAnswers.Count > 0 then
                   questAnswer.Name = refCodes.GetRefCode("ANMHAZARDOUS", chemicalAnswers(0).Value).Meaning
                end if
                theProtocol.ToxicChem = true
            case "Rad"
                Dim radioIsotopeAnswers as System.Collections.ArrayList = questAnswer.GetAnswers("Isotope")
                if radioIsotopeAnswers.Count > 0 then
                   questAnswer.Name = refCodes.GetRefCode("ANMRADIOISOTOPES", radioIsotopeAnswers(0).Value).Meaning
                end if
                theProtocol.RadioIsotope = true
        end select
        questAnswer.Save( connectionString )
        theProtocol.Save( connectionString )
    end if
end sub  
end module